<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			body,html{
				width: 100%;height: 100%;background: url(images/bg.jpg);
				overflow: hidden;position: relative;
			}
			.fireworm{
				width: 20px;height: 20px;position: absolute;
			}
			.snow{
				width: 10px;height: 10px;position: absolute;
			}
		</style>
		<script type="text/javascript" src="move.js"></script>
		<script type="text/javascript">
			onload = function(){
				//
				function fireworm(){
					this.ele=document.createElement("img");
					//
						document.body.appendChild(this.ele);
						this.ele.src="images/1.jpg";
						this.ele.className="fireworm";
						this.ele.style.left=this.randomPoint().left+"px";
						this.ele.style.top=this.randomPoint().top+"px";
						return this;
					//
					
				}
				//
				fireworm.prototype.randomPoint=function(){
						var x=parseInt(Math.random()*document.documentElement.clientWidth);
						var y=parseInt(Math.random()*document.documentElement.clientHeight);
						return{	left:x,top:y }
				}
					//
				fireworm.prototype.fly=function(){
					var that = this;
					animate(this.ele,this.randomPoint(),function(){
						that.fly();
					})
				}
				//
				var count=20;
				var timer = setInterval(function(){
					if(count-->0){
						var worm = new fireworm();
						worm.fly();
						//
						//var snowfall = new snow();
						//snowfall.fall();
					}
					else{
						clearInterval(timer);
						
					}
				},1000)
				//
				//雪花
				function snow(){
					this.ele=document.createElement("img");
					this.ele.src="images/snow.gif";
					document.body.appendChild(this.ele);
					this.ele.className="snow";
					this.ele.style.left=this.randomPoint().left+"px";
					this.ele.style.top="50px";
				}
				//
				snow.prototype.randomPoint=function(){
						var x=parseInt(Math.random()*document.documentElement.clientWidth);
						var y=parseInt(Math.random()*document.documentElement.clientHeight);
						return{	left:x,top:y }
				}
				//
				snow.prototype.fall=function(){
					var that = this;
					var ySpeed = 10;
					var num=2;
					var timer2 = setInterval(function(){
						ySpeed+=15;
						that.ele.style.top = that.ele.offsetTop + ySpeed+"px";
						if(num-->0){
							var snowfly = new snow();
							snowfly.fall();
						}
						else{
							clearInterval(timer2)
						}
					},1000)
				}
				//
				//var snowfall = new snow();
				//snowfall.fall();
				
				
			}
		</script>
	</head>
	<body>
	</body>
</html>
